package com.cavy.platform.server;

import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * 全局异常处理器
 */
@ControllerAdvice
@Slf4j
public class ExceptionControllerAdvice {

    @ExceptionHandler
    @ResponseBody
    public ResultInfo errorDto(Exception e) {
        log.error(e.getMessage());
        e.printStackTrace();
        return new ErrorResult(e);
    }

}
